﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DaInterFace.Mobile
{

    public interface IMobile
    {
        event MobileMessageHandler MessageEvent;

        IDataBase Data { get; }

        IEncrypt Encrypt { get; }

        IJson Json { get; }

        IConfig Config { get; }

        IClientMessage ClientMessage { get; }

        void Message(MessageType type, String note);

        void Message(MessageType type, String note, Double span);
    }

    public interface IMobileChild
    {
        string Code(IMobile handler,ClientUser user, string parameter);
    }

    /// <summary>
    /// 消息发送
    /// </summary>
    public interface IClientMessage
    {
        event MobileClientMessageChange MessageChanged;

        void SendByName(String account, List<String> usernames, String senduser, String title, String message);

        List<ClientMessageStruct> GetByName(String account, String username);
    }

    public class ClientMessageStruct
    {
        public String Title;
        public String Note;
        public String SendUser;
        public String SendTime;
    }

    //Code内管理用户用 保护MobileUser 部分敏感内容
    public class ClientUser
    {
        public String UserName;
        public String AccountID;
        public DateTime LoginTime;
        public DateTime VisitTime;
    }

    // 客户端访问用
    public class MobileClient
    {
        public String UserName;
        public String IMEI;
        public String Key;
        public String AccountID;
    }

    public class RSAInfo
    {
        //分配的key
        public string Key { get; set; }
        //加密公钥
        public string SeedKey { get; set; }
    }

    public class MobileParameter
    {
        public String CodeName;
        public MobileClient Client;
        public String Parameters;
    }

    public class CodeResult
    {
        public Boolean Enable;
        public String Message;
        public int Result;
        public String JsonObj;
    }

    public class LoginParameters
    {
        public String UserName;
        public String PassWord;
        public String IMEI;
        public String AccountID;
    }
    //登录
    public class LoginResult
    {
        public Boolean Enable;
        public String Message;
        public String Key;
        public int VistSpan;
    }

    public delegate void MobileMessageHandler(MessageType type, String note, Double span);

    public delegate void MobileClientMessageChange(int msgcount, int usercount);
}
